define(function(){
    
    var ImageRepository = function(callback){
        
        var self = this;
        this.imgBackground = null;
        this.imgSprites = new Image();
           
        this.loadBackground = function(imageFilename, callback){          
            this.imgBackground = new Image();
            this.imgBackground.onload = function(){
                callback(self.imgBackground);        
            };
            this.imgBackground.src = imageFilename;
        };
        
        
        // initial load
        var numImages = 1;
        var numLoaded = 0;
        var imageLoaded = function(){
            numLoaded++;
            if(numLoaded == numImages){
                callback();
            }
        };
        
        this.imgSprites.onload = function(){
            imageLoaded();
        };
        
        this.imgSprites.src = "./img/breakout_sprites.png";
    };
    
    
    return ImageRepository;
});